@extends('layouts.art')
@section('content')
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<!-- 此处不怎么好用 -->
<meta name="csrf-token" content="{{ csrf_token() }}" />
<div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">阅读</label>
        <div class="col-sm-12" id="read">
 <!--            <textarea class="form-control" rows="5" id="content" name="content">
         
                
            </textarea> -->
        </div>
</div>
<form class="form-horizontal" method="post" action="/art">
{{csrf_field()}}
    <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">标题</label>
        <div class="col-sm-8">
            <input type="title" class="form-control" id="title" name="title">
        </div>
    </div>


    <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">内容</label>
        <div class="col-sm-8">
            <!-- <textarea class="form-control" rows="5" id="content" name="content"></textarea> -->
        <!-- 加载编辑器的容器 -->
    <script id="container" name="content" type="text/plain">
        这里写你的初始化内容
    </script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        //定制自己的内容
        var ue = UE.getEditor('container', {
        autoHeight: true

    });
    </script>

        </div>
    </div>


    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default">创建</button>
        </div>
    </div>
</form>
<script src="{{ URL::asset('/plugins/jQuery/jQuery-2.1.4.min.js')}}"></script>
<script>
$("form").submit(function(event){
    var data = $("form").serializeArray();
    console.log(data);
    $.ajax({
      type:'post',
      url:'/art',
      data:data,
      headers: {
  'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content ')
},
      success:function(r){
         if (r.error == "1") {
            $("#read").html(data[1].value+' \n '+data[2].value);
        //   $('.basicEdit').hide();
        //   $('.basicShow').show();
        //   $('.basicShow span').html(data[1].value+' | '+data[2].value+' | '+data[3].value+' | '+data[4].value+'<br>'+data[5].value+' | '+data[6].value+' | '+data[7].value);
         }
      },
    });
    // event.preventDefault();
    return false;
  });
</script>
@endsection